﻿@using Csla.Web.Mvc
@using ProjectTracker.Library.Admin

@model IEnumerable<ProjectTracker.Library.Admin.RoleEdit>

@{
    ViewBag.Title = "Role list";
}

<h2>@ViewBag.Title</h2>

<p>
    @Html.HasPermission(Csla.Rules.AuthorizationActions.CreateObject, typeof(RoleEditList), 
                        Html.ActionLink("Create Role", "Create"), string.Empty) |
    @Html.HasPermission(Csla.Rules.AuthorizationActions.EditObject, typeof(RoleEditList), 
                        Html.ActionLink("Edit all roles", "EditList"), string.Empty)
</p>
<table>
    <tr>
        <th>
            Name
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.HasPermission(Csla.Rules.AuthorizationActions.EditObject, typeof(RoleEditList), 
                                Html.ActionLink("Edit", "Edit", new { id = item.Id }), "Edit") |
            @Html.HasPermission(Csla.Rules.AuthorizationActions.DeleteObject, typeof(RoleEditList), 
                                Html.ActionLink("Delete", "Delete", new { id = item.Id }), "Delete")
        </td>
    </tr>
}

</table>
